# -*- coding: utf-8 -*-
from accessFile import access
import  os
import  shutil




class Opdir():
    def __init__(self):
        pass

    def mkdir(self,path):
        access_ = access(path)
        if access_.isDir():
            return self.getAbsolutePath(path)
        else:
            os.makedirs(path)
            return self.getAbsolutePath(path)

    def rmdir(self,path):
        access_ = access(path)
        if access_.isDir():
            shutil.rmtree(path)
        else:
            return False


    def getAbsolutePath(self,path):
        pwd = os.getcwd()
        os.chdir(path)
        absolutePath = os.getcwd()
        os.chdir(pwd)
        return absolutePath


OpDir = Opdir()
DirCmd = OpDir

if __name__ == "__main__":
    # create absolute
    OpDir.mkdir("D:\\OpdirTest\\")
    a = 0
    input(a)
    # rm absolute
    OpDir.rmdir("D:\\OpdirTest\\")

    # create pwd
    OpDir.mkdir("test")

    input(a)

    OpDir.rmdir("test")

